
check_if_cheat_key_pressed:
	ld		hl,KEY_1
	call	get_keyboard
	and		a
	jr		z,check_if_cheat_key_pressed_KEY_2
	
	ld		a,1
	ld		[cpu_tower_height],a
	xor		a
	ld		[cpu_wall_height],a						;FATALITY!!! lol!
	;jr		z,check_if_cheat_key_pressed_KEY_3

check_if_cheat_key_pressed_KEY_2:
	ld		hl,KEY_2
	call	get_keyboard
	and		a
	jr		z,check_if_cheat_key_pressed_KEY_3

	ld		a,1
	ld		[background_fx_struct+1],a				;background fx begins
	;jr		z,check_if_cheat_key_pressed_end

check_if_cheat_key_pressed_KEY_3:
	ld		hl,KEY_3
	call	get_keyboard
	and		a
	jr		z,check_if_cheat_key_pressed_KEY_4

	ld		a,[show_debug_vars]
	and		a
	jr		nz,check_if_cheat_key_pressed_KEY_3_reset_debug_vars
	inc		a
	ld		[show_debug_vars],a
	jr		check_if_cheat_key_pressed_KEY_4

check_if_cheat_key_pressed_KEY_3_reset_debug_vars:
	xor		a
	ld		[show_debug_vars],a
	

check_if_cheat_key_pressed_KEY_4:
	ld		hl,KEY_4
	call	get_keyboard
	and		a
	jr		z,check_if_cheat_key_pressed_end

	ld		a,100;impossible!
	ld		hl,shop_topcards_template
	ld		[hl],a
	ld		d,h
	ld		e,l
	inc		de
	ld		bc,9
	ldir
	
	call	fire_debris_fx


check_if_cheat_key_pressed_end:

	ret



debug_display_counters:	

	;player selected card number
	ld		a,[cursor_data+1]
	ld		d,0
	ld		e,a
	ld		hl,player_hand
	add		hl,de
	ld		a,[hl]									;selected card

	ld		de,NAMTBL+(8*32)
	call	display_debug_counter


;de	screen dest position
;a card number
;destroys hl,de,af,bc contents,debug_buffer1
;			
	
	ld		a,[play_again]
	ld		de,NAMTBL+(9*32)
	call	display_debug_counter
	

	ld		a,[forced_to_drop]
	ld		de,NAMTBL+(10*32)
	call	display_debug_counter
	
	
	;enemy deck
	ld		hl,cpu_hand
	ld		a,[hl]
	
	push	hl
	ld		de,NAMTBL+(8*32)+28-3
	call	display_debug_counter
	pop		hl
	inc		hl
	ld		a,[hl]

	push	hl
	ld		de,NAMTBL+(9*32)+28-3
	call	display_debug_counter
	pop		hl
	inc		hl
	ld		a,[hl]	

	push	hl
	ld		de,NAMTBL+(10*32)+28-3
	call	display_debug_counter
	pop		hl
	inc		hl
	ld		a,[hl]	

	push	hl
	ld		de,NAMTBL+(8*32)+28+1
	call	display_debug_counter
	pop		hl
	inc		hl
	ld		a,[hl]	

	push	hl
	ld		de,NAMTBL+(9*32)+28+1
	call	display_debug_counter
	pop		hl
	inc		hl
	ld		a,[hl]	

	push	hl
	ld		de,NAMTBL+(10*32)+28+1
	call	display_debug_counter
	pop		hl
	
	jr		debug_counter_end
		
;de	screen dest position
;a card number
;destroys hl,de,af,bc contents,debug_buffer1
;		
display_debug_counter:
	push	de
	ld		h,0
	ld		l,a
	ld		de,debug_buffer1

	call	Num2Dec
	
	ld		hl,debug_buffer1
	pop		de
	ld		bc,3
	call	0x005c

	ret
		
debug_counter_end:	

	ret






show_all_patterns:
	ld		a,0
	ld		hl,tmp_buffer
show_all_patterns_loop:
	ld		[hl],a
	inc		hl
	inc		a
	jr		nz,show_all_patterns_loop

	ld 		hl,tmp_buffer
	ld 		de,NAMTBL
	ld 		bc,256
	call 	0x005c		;copy to video memory

	ld 		hl,tmp_buffer
	ld 		de,NAMTBL+256
	ld 		bc,256 
	call 	0x005c		;copy to video memory

	ld 		hl,tmp_buffer
	ld 		de,NAMTBL+256+256
	ld 		bc,256 
	call 	0x005c		;copy to video memory

	ret




show_all_sprites:
	ld		hl,tmp_buffer
	ld		b,16
	ld		c,0
	ld		d,0
	
	push	hl
	pop		ix

show_all_sprites_loop1:	
	ld		[ix],0					;y top 
	ld		[ix+1],c				;x 
	ld		[ix+2],d				;pattern
	ld		[ix+3],15				;color

	inc		ix
	inc		ix
	inc		ix
	inc		ix						;ix done
	
	ld		a,16
	add		c						
	ld		c,a						;c done
	
	inc		d
	inc		d
	inc		d
	inc		d						;d done

	djnz	show_all_sprites_loop1



	ld		hl,tmp_buffer+(16*4)
	ld		b,16
	ld		c,16
	ld		d,4*16
	
	push	hl
	pop		ix


show_all_sprites_loop2:	
	ld		[ix],16					;y top 
	ld		[ix+1],c				;x 
	ld		[ix+2],d				;pattern
	ld		[ix+3],15				;color

	inc		ix
	inc		ix
	inc		ix
	inc		ix						;ix done
	
	ld		a,16
	add		c						
	ld		c,a						;c done
	
	inc		d
	inc		d
	inc		d
	inc		d						;d done

	djnz	show_all_sprites_loop2
	
	
	ld 		hl,tmp_buffer
	ld 		de,SPRATR
	ld 		bc,32*4 ;(32 sprites * 4 attributes)
	call 	0x005c		

	halt

	ret



clean_vram:
	xor		a
	ld		hl,0
	ld		bc,16*1024
	call	0x56

	ret
	
